package tech.aistar.controller;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

/**
 * 本类用来演示: 转发和重定向
 *
 * @author: success
 * @date: 2021/4/29 8:53 上午
 */
@Controller
public class ForwardAndRedirectAction {

    @GetMapping("/day02/test01")
    public String test01(){
        System.out.println("test01...");
        return "forward:/day02/test02";
    }

    @GetMapping("/day02/test02")
    @ResponseBody
    public String test02(){
        return "test02";
    }


    @GetMapping("/day02/test04")
    public String test04(){
        System.out.println("test04...");
        return "forward:/day02/test03";
    }

    //@PostMapping("/day02/test03")
    @RequestMapping("/day02/test03")//可以一切请求的
    @ResponseBody
    public String test03(){
        return "test03";
    }
}

